<?php

$news = new Led_Entity_Collection(0, 15, $this->app->getLangid(), 2, $this->entity->newslist, 50);

if (!$news->count()) {
    $sizedoesmatter=0;
    } else {
    if ($news->count() < $this->entity->howmany) {
        $sizedoesmatter = $news->size;
    } else {
        $sizedoesmatter = $this->entity->howmany;
    }
}

$thelist = $this->app->getEdo()->fetch($this->entity->newslist);

print "<div class=\"news_headlines\">";

for ($counter = 1; $counter <= $sizedoesmatter; $counter++) {
    $news2 = $news->current();
    print "<div class=\"news_short\">\n";

    print "\n<a name=\"news" . $news2->id . "\"></a>\n";
    print"<span class=\"info\">";
    
    print date($this->entity->dateformat, $news2->date_created);
    
    if ($this->entity->showposter) {
        $theuser = $this->app->getEdo()->fetch($news2->poster);
        if ($theuser) {
            print " (" . $theuser->fullname . ")";
        }
    } 
    print"</span>";
    if ($this->entity->showheader) {
        print "<div class=\"header\">\n" . $news2->headerr . "\n</div>\n";
    }
    
    if ($this->entity->showshort) {
        if (!$this->entity->showheader) {
            print " -- ";
        }
        print $news2->shortnew;
    }
    
    if ($this->entity->destination2[0] == "marker") {
        $thelink = $entityroot . "/newsheaders/find/" . $news2->id;
    } else {
        $thelink = "/page/view/" . urlencode($this->entity->destination2[1]) . "#news" . $news2->id ;			
    }
    
    print " <a href=\"" . $thelink . "\">" . $this->entity->linktext . "</a>\n";
    print "</div>";
    $news->next();
}

print "</div>";
